<template>
	<div v-cloak class="aui-wrapper aui-page__iframe">
		<div class="aui-content__wrapper">
			<div class="aui-content">
				<el-card shadow="never" class="aui-card--fill">
					<div class="mod-lswms__orderallocation">
						<el-form :inline="true" :model="dataForm">
							<el-form-item>
								<!-- <el-input v-model="dataForm.zone" size="small" placeholder="区域" clearable></el-input> -->
								<el-select size="small" v-model="dataForm.zone">
									<el-option v-for="item in zoneList" :key="item.zonecode" :label="item.zonename"
										:value="item.zonecode">
									</el-option>
								</el-select>
							</el-form-item>
							<el-form-item>
								<el-input v-model="dataForm.count" size="small" placeholder="数量" clearable></el-input>
							</el-form-item>
							<el-form-item>
								<el-button type="primary" size="small" @click="orderEmptyLPN1()">出库</el-button>
							</el-form-item>
						</el-form>
					</div>
				</el-card>
			</div>
		</div>
	</div>
</template>

<script>
	import {
		ref,
		reactive,
		onMounted,
		nextTick
	} from 'vue';
	import {
		orderEmptyLPN
	} from '@/network/lswms/orders/Orders.js'
	import {
		getzonelisthasInventory
	} from "@/network/lswms/base/Zone.js"
	import {
		ElMessage,
		ElMessageBox
	} from 'element-plus'

	//import {hasPermission} from "@/utils/hasPermission"
	export default {
		name: "OrderEmptyLPN",

		setup() {
			const dataForm = ref({})

			onMounted(() => {
				getZoneListFn();
			})

			const orderEmptyLPN1 = () => {
				orderEmptyLPN({
					'zone': dataForm.value.zone,
					'count': dataForm.value.count

				}).then((res) => {
					if (res.code != 0) {
						return ElMessage.error(res.msg);
					}
					ElMessage({
						message: '操作成功',
						type: 'success',
						duration: 500,
						onClose: function() {

						}
					});
				}).catch()
			}
			const zoneList = ref({});
			const getZoneListFn = () => {
				getzonelisthasInventory().then((res) => {
					if (res.code !== 0) {
						return ElMessage.error(res.msg);
					}
					zoneList.value = res.data;
				}).catch((err) => {});
			}
			return {
				dataForm,
				orderEmptyLPN1,
				zoneList
			}
		},
		// methods:{
		// 	hasPermission
		// }
	}
</script>

<style scoped>

</style>
